package com.iot.service;



import com.iot.util.BaseMapper;

import java.util.List;


public abstract class BaseServiceImpl<T> implements BaseService<T> {


  //  public BaseMapper<T> baseMapper;

//    public BaseServiceImpl() {
//        SetCurrentDal();
//    }

   // public abstract void SetCurrentDal();
    public abstract BaseMapper<T> getMapper();
    @Override
    public int getRecordCount(String sWhere) {
        return getMapper().getRecordCount(sWhere);
    }

    @Override
    public int insert(T t) throws Exception {
        return getMapper().insert(t);
    }

    @Override
    public void update(T t) throws Exception {
        getMapper().update(t);
    }

    @Override
    public void deleteById(int id) {
        getMapper().deleteById(id);
    }

    @Override
    public T single(Integer id) {
        return getMapper().single(id);
    }

    @Override
    public List<T> fetch(String sWhere) {
        return getMapper().fetch(sWhere);
    }

    public T singleByWhere (String sWhere ){
        return  getMapper().singleByWhere(sWhere);
    }


}
